Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement PredicateBoxExt for ?Sized Items #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marienz
Copy link

@marienz marienz commented Dec 17, 2024

This looks like an oversight: the trait itself already had Item: ?Sized but the generic impl did not.

I noticed this while trying to chain together a variable number of predicate::str::contains(...) with and(). Calling predicates::BoxPredicate::new() explicitly works, but is much wordier than .boxed(), which fails:

173 | pub struct ContainsPredicate {
    | ---------------------------- doesn't satisfy `_: PredicateBoxExt<str>`
    |
    = note: the following trait bounds were not satisfied:
            `str: Sized`
            which is required by `ContainsPredicate: predicates::PredicateBoxExt<str>`
            `&ContainsPredicate: Predicate<_>`
            which is required by `&ContainsPredicate: predicates::PredicateBoxExt<_>`
            `&mut ContainsPredicate: Predicate<_>`
            which is required by `&mut ContainsPredicate: predicates::PredicateBoxExt<_>`

src/boxed.rs Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Dec 17, 2024

Pull Request Test Coverage Report for Build 12391484485

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 7.376%

Totals Coverage Status
Change from base Build 12124300894: 0.7%
Covered Lines: 52
Relevant Lines: 705

💛 - Coveralls

@marienz
Copy link
Author

marienz commented Dec 18, 2024

(I've force-pushed this to fix the capitalization in the commit messages pointed out by the commits lint. Code should not have changed.)

In particular, this makes `predicate::str::contains(...).boxed()` work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants